/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.meteoCal.entity;

import java.io.Serializable;
import java.security.Timestamp;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author paolo
 */
@Entity
public class Message implements Serializable {
  
    private static final long serialVersionUID = 1L;
    
    /*ATTRIBUTE*/
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long messageID;
    
    private Timestamp pubblication;
    
    private int type;

    /*RELATIONSHIP*/
    
    //MESSAGE-EVENT
    @JoinColumn(name = "EVENT", referencedColumnName = "eventID")
    @ManyToOne
    private Event event;
    
    //MESSAGE-MESSAGELIST
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "message")
    private Collection<MessageList> messageListCollection;

    public Long getMessageID() {
        return messageID;
    }

    public void setMessageID(Long messageID) {
        this.messageID = messageID;
    }

    public Timestamp getPubblication() {
        return pubblication;
    }

    public void setPubblication(Timestamp pubblication) {
        this.pubblication = pubblication;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    public Collection<MessageList> getMessageListCollection() {
        return messageListCollection;
    }

    public void setMessageListCollection(Collection<MessageList> messageListCollection) {
        this.messageListCollection = messageListCollection;
    }
}
